import request from '@/utils/request'

// 查询walmart备货计划列表
export function listPlan(query) {
    return request({
        url: '/walmart/stock/plan/list',
        method: 'get',
        params: query
    })
}

// 查询walmart备货计划详细
export function getStockPlan(stockId) {
    return request({
        url: '/walmart/stock/plan/' + stockId,
        method: 'get'
    })
}

// 新增walmart备货计划
export function addPlan(data) {
    return request({
        url: '/walmart/stock/plan',
        method: 'post',
        data: data
    })
}

// 修改walmart备货计划
export function updatePlan(data) {
    return request({
        url: '/walmart/stock/plan',
        method: 'put',
        data: data
    })
}

// 删除walmart备货计划
export function delPlan(stockId) {
    return request({
        url: '/walmart/stock/plan/' + stockId,
        method: 'delete'
    })
}

// walmart备货计划发货
export function shippingPlan(stockId) {
    return request({
        url: '/walmart/stock/plan/shippingPlan',
        method: 'put',
        data: stockId
    })
}


// 导入walmart备货计划
export function importTemplate(data) {
    return request({
        url: '/walmart/stock/plan/import/template',
        method: 'post',
        data: data
    })
}

// 导入walmart备货计划运费
// export function importFreight(data,totalAmount) {
//     return request({
//         url: '/walmart/stock/plan/importFreight?totalAmount='+totalAmount,
//         method: 'post',
//         data: data
//     })
// }

export function importFreight(data, totalAmount, calculationMode) {
  return request({
    url: '/walmart/stock/plan/importFreight',
    method: 'post',
    params: { totalAmount , calculationMode },
    data
  })
}


// 查询导入walmart计划的时候选择sku下拉框的数据
export function selectSku(stockId) {
    return request({
        url: '/walmart/stock/plan/skus/' + stockId,
        method: 'get',
    })
}

// 查询导入walmart计划的时候选择sku下拉框的数据
export function selectGTIN(stockId) {
    return request({
        url: '/walmart/stock/plan/gtins/' + stockId,
        method: 'get',
    })
}

// 查询导入walmart计划详细信息
export function getImportedPlan(stockId) {
    return request({
        url: '/walmart/stock/plan/importedPlan/' + stockId,
        method: 'get',
    })
}

// 修改备货计划物流公司
export function updateStockPlanLogistics(data) {
    return request({
        url: '/walmart/stock/plan/updateStockPlanLogistics',
        method: 'post',
        data: data
    })
}

// 修改备货计划体积计算模式
export function updateStockPlanVolumeMode(data) {
    return request({
        url: '/walmart/stock/plan/updateStockPlanVolumeMode',
        method: 'post',
        data: data
    })
}

// 修改备货计划快递单号
export function updateStockTrackingNumber(data) {
    return request({
        url: '/walmart/stock/plan/updateStockTrackingNumber',
        method: 'post',
        data: data
    })
}

// 获取walmart备货计划清单信息
export function getStockProductDetails(stockId) {
    return request({
        url: '/walmart/stock/plan/getStockProductDetails/' + stockId,
        method: 'get',
    })
}
// 绑定备货计划
export function bingShipmentStock(data) {
    return request({
        url: '/walmart/stock/plan/bingShipmentStock',
        method: 'post',
        data: data
    })
}


